package sdau.hjk.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import sdau.hjk.entity.Covid19;

import java.util.List;

/**
 *@version 1.0
 *@author: huangjiakai
 *@create:2021−03-25 15:12
 *@className:sdau.hjk.dao.ICovid19DataDao
 *@description: TODO
 */
@Repository
public interface ICovid19DataDao {
    //首次添加疫情数据
    @Insert("insert into covid19(locationId,provinceName,provinceShortName,currentConfirmedCount,confirmedCount,suspectedCount,curedCount,deadCount,highDangerCount,midDangerCount,detectOrgCount,vaccinationOrgCount) " +
            "values(#{locationId},#{provinceName},#{provinceShortName},#{currentConfirmedCount},#{confirmedCount},#{suspectedCount},#{curedCount},#{deadCount},#{highDangerCount},#{midDangerCount},#{detectOrgCount},#{vaccinationOrgCount})")
    public void saveData(Covid19 covid19);
    //更新疫情数据
    @Update("update covid19 set currentConfirmedCount = #{currentConfirmedCount}, confirmedCount = #{confirmedCount}, suspectedCount = #{suspectedCount}, curedCount = #{curedCount}, deadCount =#{deadCount}, highDangerCount = #{highDangerCount}, midDangerCount = #{midDangerCount}, detectOrgCount = #{detectOrgCount}, vaccinationOrgCount = #{vaccinationOrgCount} " +
            "where locationId = #{locationId}")
    public void updateData(Covid19 covid19);
    //查询每日疫情数据
    @Select("select * from covid19")
    public List<Covid19> findAll();
}
